//
//  UIImageView+FTLanguage.m
//  FashionTech
//
//  Created by JackieYip on 16/9/20.
//  Copyright © 2016年 mondial-d. All rights reserved.
//

#import "UIImageView+FTLanguage.h"

// Component_FTBundle
#import "FTMediator+FTBundle.h"
// FTMediator
#import "FTMediator.h"
// FTMacro
#import "FTMacro_Screen.h"

@implementation UIImageView (FTLanguage)

- (NSString *)pngImageLocalString
{
    return @"";
}
- (NSString *)JPEGImageLocalString
{
    return @"";
}

- (void)setPngImageLocalString:(NSString *)imageLocalString
{
    [self setImageLocalString:imageLocalString withType:@"png"];
}

- (void)setJPEGImageLocalString:(NSString *)imageLocalString
{
    [self setImageLocalString:imageLocalString withType:@"jpg"];
}

- (void)setImageLocalString:(NSString *)imageLocalString withType:(NSString *)type
{
    imageLocalString = [NSString stringWithFormat:@"%@@%ldx", imageLocalString, (long)[UIScreen mainScreen].scale];
    NSString *bundle = [[kFTMediator FTBundle_bundle] pathForResource:imageLocalString ofType:type];
    
    self.image = [UIImage imageWithContentsOfFile:bundle];
    CGSize size = self.image.size;
    if (size.width > kScreenWidth) {
        size = CGSizeMake(kScreenWidth, self.image.size.height/self.image.size.width * kScreenWidth);
    }
    self.frame = CGRectMake(0, 0, size.width, size.height);
}

@end
